#pragma  once

class CLineDisplay
{
public:
    CLineDisplay(int nType, int nPort);
    virtual ~CLineDisplay() {}

    virtual BOOL Initialize();
    
    virtual BOOL DisplayText(LPCTSTR pStr, int nLength, int nLine = 1) {return TRUE;}
	virtual BOOL DisplayTextEx(char *pszText, int nLen) {return TRUE;}
    virtual BOOL ClearText() {return TRUE;} 

    virtual BOOL SetDescriptor(UINT nFlag) {return TRUE;}
    virtual BOOL ClearDescriptor() {return TRUE;}

    BOOL Close();

    int GetType() const {return m_nType;}
    int GetLastError() const {return m_nError; }

protected:
    BOOL SendString(LPCTSTR lpStr, int nLen);
	BOOL SendStringEx(char* pszText, int nLen);

    int m_nType;
    int m_nPort;
    int m_nError;

    //zhwang: to do, can be packaged in one struct
    int m_nParity;
    HANDLE m_hCom;
    OVERLAPPED m_oWrite;
    OVERLAPPED m_oRead;
};

class CVC220 : public CLineDisplay
{
public:
    CVC220(int nPort);
    virtual ~CVC220() {}

    virtual BOOL Initialize();

    virtual BOOL DisplayText(LPCTSTR pStr, int nLength, int nLine = 1);
};

class CVC110 : public CLineDisplay
{
public:
    CVC110(int nPort);
    virtual ~CVC110() {}

    virtual BOOL Initialize();
    
    virtual BOOL DisplayText(LPCTSTR pStr, int nLength, int nLine = 1);
	virtual BOOL DisplayTextEx(char *pszText, int nLen);
    virtual BOOL ClearText();

    virtual BOOL SetDescriptor(UINT nFlag);
    virtual BOOL ClearDescriptor();
};

